home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 748 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  3.7 KB

  1. From: mh1@irz301.inf.tu-dresden.de (Michael Hohmuth)
  2. Subject: Re: ext. ARGV
  3. Date: Mon, 10 Jan 1994 17:32:35 +0100 (MET)
  4. In-Reply-To: <9401100743.AA15875@math.uni-muenster.de> from "Julian Reschke" at Jan 10, 94 08:43:58 am
  5. Mime-Version: 1.0
  6.  
  7. > I think I remember that the format was
  8. > ARGV=NULL:<string>
  9. > where <string> contains a '0' for empty args and '1' for the others.
  10. > The MiNT-Lib startup seems to use:
  11. > idx,idx,...
  12. > Where idx are decimal encoded positions of empty args. Is this really the
  13. > 'right' way?
  14.  
  15. I think so.  This is the way we agreed on when I proposed this ARGV
  16. extension, which was why I implemented it that way in mntlib.
  17.  
  18. I ship my distributions of `sh' and `tcsh' with the following document
  19. which summarizes the proposal:  [ below my .signature ]  I encourage
  20. everyone to spread it to clear up any confusion.
  21.  
  22. Greetings,
  23. Michael
  24. -- 
  25. Internet: hohmuth@freia.inf.tu-dresden.de
  26.  
  27.  
  28. This is a proposal for an extension of Atari's ARGV argument passing scheme
  29. standard.  It has been discussed on the MiNT mailing list.  Please note
  30. that this proposal should not yet be regarded as an "official" Atari
  31. standard; however, according to Atari's Eric Smith, it's unlikely that
  32. Atari's new standard will differ a lot from the one proposed here.
  33.  
  34.                                   *
  35.  
  36. This ARGV standard extension adds the possibility of passing blank (i.e.,
  37. zero length) arguments via the command line when calling another program.
  38.  
  39. The ARGV extended argument passing scheme standard should be extented by
  40. the following clauses:
  41.  
  42.     If the command line does _not_ contain blank arguments, the old ARGV 
  43.     standard applies; there are no additions.  This is for maximal 
  44.     backwards compatibility with old (unaware) applications.
  45.  
  46.     _If_ (and only if) there are blank arguments, they're substituted by 
  47.     single spaces in the argv[] representation in the environment and
  48.     by the string "''" (two single quotes) in the basepage's command 
  49.     line representation.  Their position in argv[] is signaled thru the 
  50.     value of the "ARGV=" environment variable (which was reserved by 
  51.     Atari's earlier standard for future usage).  This value consists of 
  52.     the string "NULL:", followed by a comma-separated list of decimal-
  53.     encoded indexes to the positions of the blank arguments in the 
  54.     argv[] vector.
  55.  
  56. Example:  The following command:
  57.     foo bar '' '' blah '' frob
  58. results in the following being appended to the child's environment:
  59.     "ARGV=NULL:2,3,5\0foo\0bar\0 \0 \0blah\0 \0frob\0\0"
  60. The basepage contains the following string at offset 0x80:
  61.     "\177bar '' '' blah '' frob\0"
  62.  
  63. A program which is aware of the new standard will notice the magic word 
  64. "NULL" in ARGV's value and will decode the argv[] indexes it signals.
  65.  
  66. A program which is not aware of the new standard, but which is aware
  67. of Atari's old ARGV standard will see spaces in place of blank
  68. arguments.  The spaces have been introduced to guarantee that
  69. the parameters stay on their positions.
  70.  
  71. Non-ARGV-aware programs (those which read their command line from their
  72. basepage) should see the parameters in the right place too..  Of course,
  73. a space can't be inserted in place of an blank argument because spaces
  74. separate words in the basepage's command line, which is why the single
  75. quotes have been introduced.
  76.  
  77. Those programs that use the value of ARGV= for other purposes (Mark
  78. Williams C compiled programs) will conform/work as long as they're not
  79. passed blank args.  If someone tries to pass blank args to them from an
  80. aware shell, these programs will lose.  However, these programs would
  81. also lose in this case if the (new) standard wouldn't exist (because
  82. blank arguments are impossible resp. truncate the ARGV parameters in the
  83. environment), so this is not really a problem.
  84.